package com.lmm.rpc.core.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @title: IpRegexUtil
 * @Description: Ip合法性验证
 * @Author Lmm
 * @Date: 2022/9/29 15:51
 * @Version 1.0
 */
public class IpRegexUtil {
    /**
     *    验证Ip合法性
     * */
    public static final String REGEX_IP = "[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}:[0-9]{1,5}#[0-9]{1,}[,]{0,}]+";
    public static boolean match(String ips) {
        Pattern pattern = Pattern.compile(REGEX_IP);
        Matcher matcher = pattern.matcher(ips);
        return matcher.matches();
    }
}
